package com.zsy.text.to.phone.repository;

import com.zsy.text.to.phone.domain.TextBO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;

@Mapper
public interface TextRepository {

    @Select("select * from my_text where is_valid=1 limit 1")
    TextBO selectCurText();

    @Update("update my_text set is_valid=0, update_time=now() where is_valid=1")
    int updateCurTextNotValid();

    @Insert("insert my_text (text,create_time) values (#{text},now())")
    int insertText(@Param("text") TextBO textBo);

}
